﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="SaleAnalyseReport.aspx.cs" Inherits="PMS.UI.DS.SaleAnalyseReport" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            var height = $("#divTotal").height();
            var master = $("#master").height();
            var content = parseFloat(height) - parseFloat(master) - 30;
            $("#tbList").css("height", content);
        });
    </script>

    <script type="text/javascript">
        $(function () {
            $("#tbList").datagrid({
                url: '/Logic/DS/DataAnalysAjax.aspx?method=GetContractList',
                loadMsg: '数据加载中请稍后……',
                fitColumns: false,
                pagination: true,
                queryParams: com.serializeSearchArray("form1"),
                rownumbers: true,
                idField: "ID",
                singleSelect: true,
                pageSize: 20,
                pageList: [20, 50, 100],
                striped: true,
                frozenColumns: [[{ field: 'ck', checkbox: true, width: 30 },
                 { field: 'ID', title: 'ID', align: "center", width: 40 },
                 {
                     field: 'Code', title: '合同编号 ', align: "center", width: 120
                 },
                   {
                       field: 'ContractName', title: '合同名称', align: "center", width: 200
                   },
                   {
                       field:'ContractMoney',title:'合同金额',align:'center',width:60
                   },
                   {
                       field: 'SignDate', title: '签订时间', align: 'center', width: 120
                   }
                ]],
                columns: [[
                 {
                     field: 'Address', title: '签订地点', align: "center", width: 200
                 },
                 {
                     field: 'SupplierName', title: '供方', align: "center", width: 120
                 },
                 {
                     field: 'CustomerName', title: '需方', align: "center", width: 120
                 },
                {
                    field: 'Note', title: '备注', align: "center", width: 200
                }]],
            });

        });
    </script>

    <script type="text/javascript">
        //查询
        function funcSearch() {
            var para = com.serializeSearchArray("form1");
            $("#tbList").datagrid("load", para);
        }

        //重置
        function funcReload() {
            $("#form1").form("reset");
            var para = com.serializeSearchArray("form1");
            $("#tbList").datagrid("load", para);
        }

        //导出
        function funcToExcel() { 
            var para = com.serializeSearchArray1("form1");
            //列标题
            var cellhead = {
                "ID": "ID", "Code": "合同编号", "ContractName": "合同名称", "ContractMoney": "合同金额",
                "SignDate": "签订时间", "Address": "签订地点", "SupplierName": "供方", "CustomerName": "需方", "Note": "备注"
            }
            var form = {};
            form['searchData'] = para;
            form['cellhead'] = JSON.stringify(cellhead);
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/Logic/DS/DataAnalysAjax.aspx?method=SaleAnalyse2Excel",
                data: form,
                success: function (data) {
                    location.href = location.origin + '/' + data;
                }
            })
        }

    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
    <a href="javascript:void(0)" id="btnSearch" class="easyui-linkbutton" onclick="funcSearch()"
        data-options="iconCls:'icon-search',plain:true">查询</a> &nbsp;&nbsp;
    <a href="javascript:void(0)" id="btnReset" class="easyui-linkbutton" onclick="funcReload()"
        data-options="iconCls:'icon-reload',plain:true">重置</a> &nbsp;&nbsp;
    <a href="javascript:void(0)" id="btnToExcel" class="easyui-linkbutton" onclick="funcToExcel()"
        data-options="iconCls:'icon-page_excel',plain:true">导出Excel</a> &nbsp;&nbsp;
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <div id="divTotal" style="height: 100%; width: 100%">

        <div id="master" class="container_12" style="height: auto">
            <form id="form1">
                <div class="grid_1 sealbl" style="width: 100px">
                    合同编号 :
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="Code" name="Code" data-cp="co" />
                </div>
                <div class="grid_1 sealbl" style="text-align: right;">
                    名称 :
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="ContractName" name="ContractName" data-cp="co" />
                </div>
                <div class="grid_1 sealbl" style="text-align: right;">
                    需方 :
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="CustomerName" name="CustomerName" data-cp="co" />
                </div>
                <div class="Clear"></div>
                <div class="grid_1 sealbl" style="width: 100px">
                    签订时间从年月:
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="startSignDate" name="startSignDate" data-cp="str>=" class="easyui-datebox" />
                </div>
                <div class="grid_1 sealbl">
                    到年月:
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="endSignDate" name="endSignDate" data-cp="str<=" class="easyui-datebox" />
                </div>
            </form>
        </div>
        <table id="tbList" title="合同表 " style="width: 100%">
        </table>
    </div>
</asp:Content>
